import axios from "@/utils/http"



// 学生登录
export function stuLogin(user:any){
    return axios({
        method:"post",
        url:"/sso/student/login",
        // url:"/test.do",
        data:JSON.stringify({
            	"code": "",
                "password": user.password,
                "phone": "",
                "username": user.username
        }),
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}


// 教师登录
export function teachLogin(user:any){
    return axios({
        method:"post",
        url:"/sso/teacher/login",
        // url:"/test.do",
        data:JSON.stringify({
            	"code": "",
                "password": user.password,
                "phone": "",
                "username": user.username
        }),
                headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
       
    })
}

//教师发送验证码
export function teaCode(userInfo:any){
    console.log(userInfo);
    
    return axios({
        method:"get",
        url:`/sso/teacher/sendCode/${userInfo.phone}`
    })
}
// 教师手机号登录
export function teacherPhone(userInfo:any){
    console.log(userInfo.code);
    
    return axios({
        method:"post",
        url:"/sso/teacher/oneLogin",
        headers:{
            "Content-Type":"application/json"
        },
        data:{
            "phone":userInfo.phone,
            "code":userInfo.code
        }
    })
}



//学生发送验证码
export function stuCode(userInfo:any){
    return axios({
        method:"get",
        url:`/sso/student/code/${userInfo.phone}`
    })
}
// 学生手机号登录
export function studentPhone(userInfo:any){
    return axios({
        method:"post",
        url:"/sso/student/oneLogin",
        headers:{
            "Content-Type":"application/json"
        },
        data:{
            "phone":userInfo.phone,
            "code":userInfo.code
        }
    })
}